import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  actions: {
    add(textcont, n) {
      textcont.commit('ADD', n)
    },
    minus(textcont, n) {
      textcont.commit('MINUS', n)
    }
  },
  mutations: {
    ADD(state, n) {
      state.totalPrice += n
    },
    MINUS(state, n) {
      state.totalPrice -= n
    }
  },
  state: {
    totalPrice: 0
  },
  modules: {}
})
